import Vue from 'vue'
import Router from 'vue-router'

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};
//主题
import agentadmin from '@/components/agentadmin'
//登陆页面
import login from '@/components/login/login'
//错误页面
import errorPage401 from '@/components/errorPage/errorPage401'
import errorPage404 from '@/components/errorPage/errorPage404'
//首页
import homePage from '@/components/homePage/homePage'
//个人中心页面
import personagePage from '@/components/personagePage/personagePage'
//在线接口调试
import connectorDebug from '@/components/connector/connectorDebug'
//商户页面
import merchantList from '@/components/merchant/merchantList'
import merBusinessList from '@/components/merchant/merBusinessList'
import merBusinessConfigList from '@/components/merchant/merBusinessConfigList'
import merchantProfitList from '@/components/merchant/merchantProfitList'
//卡页面
import applyCardList from '@/components/card/applyCardList'
import cardEvalutionList from '@/components/card/cardEvalutionList'
import cardAuthentication from '@/components/card/cardAuthentication'
import postersManage from '@/components/card/postersManage'
import articleManage from '@/components/card/articleManage'
import userListManage from '@/components/card/userListManage'
//系统管理
import systemUser from '@/components/systemManagement/systemUser'
import userGroup from '@/components/systemManagement/userGroup'
import editPermission from '@/components/systemManagement/editPermission'
Vue.use(Router);
export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'agentadmin',
      redirect:'/homePage',
      component: agentadmin,
      children:[{
        path: 'homePage',
        name: 'homePage',
        meta:{title:'首页'},
        component: homePage,
        },{
        path: 'personagePage',
        name: 'personagePage',
        meta:{title:'个人中心'},
        component: personagePage,
        },{
        path: 'connectorDebug',
        name: 'connectorDebug',
        meta:{title:'在线接口测试'},
        component: connectorDebug,
        },{
        path: 'applyCardList',
        name: 'applyCardList',
        meta:{title:'办卡列表'},
        component: applyCardList,
      },{
        path: 'cardEvalutionList',
        name: 'cardEvalutionList',
        meta:{title:'卡测评'},
        component: cardEvalutionList,
      },{
        path: 'cardAuthentication',
        name: 'cardAuthentication',
        meta:{title:'银行卡鉴权'},
        component: cardAuthentication,
      },{
        path: 'postersManage',
        name: 'postersManage',
        meta:{title:'海报管理'},
        component: postersManage,
      },{
        path: 'articleManage',
        name: 'articleManage',
        meta:{title:'文章管理'},
        component: articleManage,
      },{
        path: 'userListManage',
        name: 'userListManage',
        meta:{title:'海报用户列表'},
        component: userListManage,
      },{
        path: 'merchantList',
        name: 'merchantList',
        meta:{title:'商户列表'},
        component: merchantList,
      },{
        path: 'merBusinessList',
        name: 'merBusinessList',
        meta:{title:'商户业务列表'},
        component: merBusinessList,
      },{
        path: 'merBusinessConfigList',
        name: 'merBusinessConfigList',
        meta:{title:'商户业务配置'},
        component: merBusinessConfigList,
      },{
        path: 'merchantProfitList',
        name: 'merchantProfitList',
        meta:{title:'商户分润列表'},
        component: merchantProfitList,
      },{
        path: 'systemUser',
        name: 'systemUser',
        meta:{title:'系统用户'},
        component: systemUser,
      },{
        path: 'userGroup',
        name: 'userGroup',
        meta:{title:'用户分组'},
        component: userGroup,
      },{
        path: 'editPermission',
        name: 'editPermission',
        meta:{title:'用户权限'},
        component: editPermission,
      }]
    },{
      path: '/login',
      name: 'login',
      component: login,
    },{
      path: '/errorPage401',
      name: 'errorPage401',
      component: errorPage401,
    },{
      path: '/errorPage404',
      name: 'errorPage404',
      component: errorPage404,
    },{
      path: '*',
      redirect:'/errorPage404',
    }
  ]
})
